#include <cstdio>

using namespace std;

const int maxn = 100010;

int main() {
	int n, temp, k;
	int score[maxn] = {0};

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &temp);
		score[temp] += 1;
	}

	scanf("%d", &k);
	for (int i = 0; i < k; i++) {
		scanf("%d", &temp);
		printf("%d%c", score[temp], i==k-1?'\n':' ');
	}
	
}
